<!DOCTYPE html>
<html>
<head>
    <title>公式编辑器</title>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <script src="dev-lib/jquery-1.11.0.min.js"></script>
    <script src="dev-lib/kitygraph.all.js"></script>
    <script src="dev-lib/kity-formula-render.all.js"></script>
    <script src="dev-lib/kity-formula-parser.all.js"></script>
    <script src="dev-lib/dev-define.js"></script>
    <script>
        inc.config({
            base: './src'
        });
    </script>
    <script src="dev-lib/exports.js"></script>
    <script src="dev-lib/start.js"></script>
    <script src="dev-lib/dev-start.js"></script>
    <!-- <script src="dist/kityformula-editor.all.min.js"></script> -->
    <script>
        jQuery( function ($) {

            var factory = kf.EditorFactory.create( $( "#kfEditorContainer" )[ 0 ], {
                render: {
                    fontsize: 40
                },
                resource: {
                    path: "./resource/"
                }
            } );

            factory.ready( function ( KFEditor ) {

                // this指向KFEditor

                this.execCommand( "render", "1" );
                this.execCommand( "focus" );

                window.kfe = this;

            } );
            $('#click').click(function () {
                kfe.execCommand('get.image.data', function(data){
                    var latex = kfe.execCommand('get.source');
                    // alert('<img class="kfformula" src="'+ data.img +'" data-latex="' + latex + '" />')
                    console.log('<img class="kfformula" src="'+ data.img +'" data-latex="' + latex + '" />');
                    // editor.execCommand('inserthtml', '<img class="kfformula" src="'+ data.img +'" data-latex="' + latex + '" />');
                });
            })

        } );
    </script>
    <link rel="stylesheet" href="assets/styles/page.css">
    <link rel="stylesheet" href="assets/styles/base.css">
    <link rel="stylesheet" href="assets/styles/ui.css">
    <link rel="stylesheet" href="assets/styles/scrollbar.css">
</head>
<body>
    <div id="kfEditorContainer" class="kf-editor" style="width: 100%; height: 100%; position: absolute;"></div>
    <!-- <button type="button" id="click" style="position: absolute;bottom: 0;">test</button> -->
</body>
</html>